home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr27
/
iswht10.zip
/
ISWHAT.DOC
< prev
next >
Wrap
Text File
|
1995-03-26
|
11KB
|
284 lines
- IsWhat 1.0 -
Batch File Utility
Query Date/Day and Rename Functions
(c)Copyright 1995, Rand Nowell - RaLin Enterprises
"Cowboy Software!" Free Use
Welcome to IsWhat. I had need of a utility like this, and found
several that would give Day of Year, or Day of Week, but thats
all. I needed one that would do much more, so once again,
the wheel was re-invented!
IsWhat does all the above and a lot more. If you need to perform
system events on certain days, or in certain weeks, or in a
certain month.... IsWhat is the tool you need.
IsWhat works best from a batch file, where you can test the
errorlevel returned by the program, and branch to a specific
part of your batch file using batchfile labels.
Not only for batch file use, IsWhat has three commands,
CALENDAR, DATENAME and DOYNAME which can be real handy in day to day
use, right from the command prompt.
LEGAL STUFF -
IsWhat is NOT Public Domain, the code/executables/documentation are
all protected under Copyright, by the author, Rand Nowell.
This copy of IsWhat is released as FreeWare.
This means you are free to use it without any registration, or
monetary compensation to the author. It also means you can use as
many copies as you wish, on as many systems as you wish.
You may also give copies to your friends, upload to other systems,
and otherwise freely distribute, subject to limitations below.
You may NOT include IsWhat "bundled" with other software, without
written permission of the author. Shareware DISK vendors MAY
include it on their disk's, as long as they charge no more than
$5.00 for a disk, AND inform the user that this fee is a COPY fee,
not a registration fee for programs on disk
FreeWare does NOT give you the right to the following:
* Decompiling, reverse engineering, or otherwise modifying the program.
* Demanding additions/updates or fixes to the program.
* Accepting any form of payment for the program. BBS sysops of
course may charge an access fee to users, before they can obtain
this program from their system. But no direct payment for IsWhat.
You are MORE than welcome to "suggest" additions and enhancements.
In most cases, they are implemented, if they are good ones, that will
benefit all users.
The author is not obligated to provide future versions of this program.
No warranties are made, you accept all liability for any damages from
use of the program. Though it has been well tested, your only guarentee
is that it will consume disk space.
Any future version(s) may become Shareware, where a registration is
required to activate certain features.
REGISTRATION -
No registration is asked for or required for this version of IsWhat.
Although if you find it useful, and use it a lot, a note or postcard
would be highly appreciated!!
And of course, if you are just itching to part with some cash, a
donation is always appreciated. It helps defray costs of development
and distribution of utils like IsWhat.
A suggested donation would be $5.00, but any amount is gratefully
received.
OVERVIEW -
IsWhat lets you determine the following:
o What DAY of the WEEK it is
o What DAY of the MONTH it is
o What MONTH of the YEAR it is
o What DAY of the YEAR it is
It also allows you to rename a file with the current date as part
of the filename, or with a "Day of Year" extension.
And it can display a scrolling calendar to the screen, allowing you
to browse through days, months and years to figure out past, present
and future dates.
HOW TO RUN -
IsWhat displays a Copyright line and a small message pertaining to
the current function results, when it is run. If you do NOT
want any messages displayed, in your batch file, set the environment
variable IWSHOW=NO ie: set iwshow=no
Setting it to null, or Yes allows the display, as does not setting
it at all.
IsWhat is run with a command, some of which require an additional
value after the command.
There will be a short refresher course on using errorlevels in batch
files, after this section.
Running IsWhat with a question mark, (?) will display an online
help screen, listing all available commands and syntax.
Example: ISWHAT <command> [value]
IMPORTANT NOTE!!
All values returned are based on the system date set on your PC.
If the date is wrong, the values will be wrong.
The following, are all the function commands available, what extra
values are required by any, and the proper command line syntax.
DOW - Day of Week - Returns Errorlevel of 1 - 7
Command: ISWHAT DOW
DOW will tell you what day of the week it is, by returning the
number of the day to the calling program.
The days are numbered as such:
1 - Sunday
2 - Monday
3 - Tuesday
4 - Wednesday
5 - Thursday
6 - Friday
7 - Saturday
MONTH - Month of the Year - Returns Errorlevel of 1 - 12
Command: ISWHAT MONTH
MONTH will tell you what month of the year it is, value returned
is correspondent with the placement of the month in the calendar.
ie: January = 1, March = 3, December = 12 etc.
DOM - Day of Month - Returns Errorlevel of 1 - 31
Command: ISWHAT DOM
DOM returns the value of the day of the month, ie: if its
March 27th, 1995 it will return errorlevel 27 - simple..
DOY - Day of the Year - Returns Errorlevel of 1 - 365
Command: ISWHAT DOY
DOT will simply tell you what day of the year it is.
DATENAME - Renames file with current date as root name.
Command: ISWHAT DATENAME [??/]<filename>
Will obtain the current date, and rename the file with that
name, and the files existing extension.
Example: ISWHAT datename janrpt.zip run on March 26th 1995
will result in the file being renamed 032695.ZIP
You may give an optional 2 character prefix which will be added
in front of the datestring for the new filename. The two characters
MUST come before the name of the file to rename, and MUST be
followed by the forward SLASH (/) character, and there MUST be
NO spaces in the string. DATENAME RA/RA.LOG is correct,
DATENAME RA/ RA.LOG is Wrong!! The above will result in a name
such as RA032695.ZIP
DOYNAME - Renames file with same root name, with extension of Day of Year.
Command: ISWHAT DOYNAME <filename>
Example: DOYNAME TRIAL.ZIP results in TRIAL.084, assuming the
current day of the year is 84. Day numbers are zero padded to
3 characters.
DATE - Compares given date to current date, and if its a match
will return an Errorlevel of 1. If the dates do not match,
it will return and errorlevel of 0.
Command: ISWHAT DATE <date to test>
Example: ISWHAT DATE 03/26/95
The format of the date must follow the above example, or you
will get an Invalid Date error, the error is also generated
if the date is just plain invalid, as in 13/03/95.
Use the forward slashed (/) not \ or -
CALENDAR - Display scrolling calendar, current date highlighted.
Command: ISWHAT CALENDAR
NOTE! The calendar colors are set for a Color Monitor.
It has not even been tested on Mono, not sure how it
will display in that environment.
While the calendar is displayed, you can move through the
days, months, and years. The following keys act as described.
LftArrow/RtArrow - Increment/Decrement Day
UpArrow/DnArrow - Increment/Decrement Week
PgUp/PgDn - Increment/Decrement Month
End - Increment Year
Home - Decrement Year
<M> - Beginning of month, or if there, beginning
of previous month.
<H> - End of month, or if on last day, to last day
of next month.
<Y> - First day of year, or previous as above.
<R> - Last day of year, or Next as above.
<+-> - Advance or Back one day
Pressing ESCape will exit the Calendar.
Pressing ENTER on a date, will exit and display the date chosen.
BATCH FILE ERROR LEVELS:
Using errorlevels returned by programs called from within the
batch file, provide, along with the use of LABELS, a very powerful
programming tool.
One of the most common errors users seem to stumble on, is the
order in which errorlevels are tested.
Errorlevels must ALWAYS be tested from HIGHEST to LOWEST. Assuming
a program will be returning errorlevels in the range of 1 to 20, you
would first check for errorlevel 20, then 19, then 18 and so on.
You can skip an errorlevel if you do not need to do anything based
on that level.
The syntax for checking an errorlevel is "IF ERRORLEVEL ###" followed
by the command to execute. Which can be a dos command, or a GOTO <label>
command. You can also check to see if the errorlevel is NOT a certain
one, ie: "IF NOT ERRORLEVEL ###" this can be used in conjunction
with the "IF ERRORLEVEL" to closely test errorlevel values.
The included IW_DEMO.BAT has a few of these, and some GOTO <label> calls,
which can help explain. If you are not familiar with using errorlevels
and goto commands in your batch files, my best suggestion is to obtain
a book on batch file programming. There are some good ones out there.
I am NOT a batch file expert, though I can usually make them do what I
want. But the example IW_DEMO.BAT should help you somewhat.
Again, this is not a conclusive lesson on batch file programming using
errorlevels and goto commands. Just a small refresher thing.
CLOSING -
I hope you find IsWhat a useful tool.
If you do, I'd like to hear about it. Send me a note or a postcard.
I am also open to suggestions....
Rand Nowell Voice: 510-651-6177
4641 Wheeler Dr. BBS: 510-226-7731
Fremont, Ca. 94538 Fido: 1:215/710
RaLin Enterprises - Home of "Cowboy Software!"